﻿<Window x:Class="FEZFirmwareUpdater.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        mc:Ignorable="d"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"        
        Title="FEZ Firmware Updater"
        FontSize="14"
        ResizeMode="NoResize"
        Width="500"
        SizeToContent="Height"
        Icon="icon.ico"
        Loaded="Window_Loaded"
        Closing="Window_Closing"
        SizeChanged="Window_SizeChanged"
        WindowStartupLocation="CenterScreen"
        SnapsToDevicePixels="True">
    <Grid Grid.IsSharedSizeScope="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <TextBlock FontSize="18"
                       Foreground="White"
                       FontWeight="Bold"
                       Text="Update your FEZ in one click">
                <TextBlock.RenderTransform>
                    <TranslateTransform X="1"
                                        Y="1" />
                </TextBlock.RenderTransform>
            </TextBlock>
            <TextBlock FontSize="18"
                       Foreground="White"
                       FontWeight="Bold"
                       Text="Update your FEZ in one click">
                <TextBlock.RenderTransform>
                    <TranslateTransform X="-1"
                                        Y="-1" />
                </TextBlock.RenderTransform>
            </TextBlock>
            <TextBlock FontSize="18"
                       Foreground="White"
                       FontWeight="Bold"
                       Text="Update your FEZ in one click">
                <TextBlock.RenderTransform>
                    <TranslateTransform X="-1"
                                        Y="1" />
                </TextBlock.RenderTransform>
            </TextBlock>
            <TextBlock FontSize="18"
                       Foreground="White"
                       FontWeight="Bold"
                       Text="Update your FEZ in one click">
                <TextBlock.RenderTransform>
                    <TranslateTransform X="1"
                                        Y="-1" />
                </TextBlock.RenderTransform>
            </TextBlock>
            <TextBlock FontSize="18"
                       Foreground="Black"
                       FontWeight="Bold">
                Update your FEZ in one click
            </TextBlock>
        </Grid>

        <Border Grid.Row="1" x:Name="border1"
                Style="{StaticResource panel}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <StackPanel Grid.Row="0"
                            Orientation="Horizontal">
                    <TextBlock x:Name="deviceStatus" 
                               FontWeight="DemiBold"
                               TextWrapping="WrapWithOverflow"></TextBlock>
                </StackPanel>
                <StackPanel Grid.Row="1"
                            Orientation="Horizontal">
                    <TextBlock FontSize="12">Device Version :</TextBlock>
                    <TextBlock x:Name="deviceVersion"
                               FontSize="12">unknown</TextBlock>
                </StackPanel>
                <StackPanel Grid.Row="2"
                            Orientation="Horizontal">
                    <TextBlock FontSize="12">Available Version :</TextBlock>
                    <TextBlock x:Name="availableVersion"
                               FontSize="12">unknown</TextBlock>
                </StackPanel>
            </Grid>
        </Border>

        <Button x:Name="start"
                Grid.Row="2"
                Grid.Column="1"
                Grid.ColumnSpan="2"
                Click="StartClick">
            Update your FEZ firmware
        </Button>

        <ProgressBar x:Name="progress"
                     Visibility="Hidden"
                     Height="30"
                     Grid.Row="3" />

        <Expander Grid.Row="4">
            <Expander.HeaderTemplate>
                <DataTemplate>
                    <Grid>
                        <TextBlock Foreground="White"
                                   Text="Advanced options...">
                            <TextBlock.RenderTransform>
                                <TranslateTransform X="1"
                                                    Y="1" />
                            </TextBlock.RenderTransform>
                        </TextBlock>
                        <TextBlock Foreground="White"
                                   Text="Advanced options...">
                            <TextBlock.RenderTransform>
                                <TranslateTransform X="-1"
                                                    Y="-1" />
                            </TextBlock.RenderTransform>
                        </TextBlock>
                        <TextBlock Foreground="White"
                                   Text="Advanced options...">
                            <TextBlock.RenderTransform>
                                <TranslateTransform X="-1"
                                                    Y="1" />
                            </TextBlock.RenderTransform>
                        </TextBlock>
                        <TextBlock Foreground="White"
                                   Text="Advanced options...">
                            <TextBlock.RenderTransform>
                                <TranslateTransform X="1"
                                                    Y="-1" />
                            </TextBlock.RenderTransform>
                        </TextBlock>
                        <TextBlock Text="Advanced options...">
                        </TextBlock>
                    </Grid>
                </DataTemplate>
            </Expander.HeaderTemplate>
            <StackPanel>
                <Border Style="{StaticResource panel}">
                    <GroupBox Header="Serial port">
                        <StackPanel>
                            <ComboBox x:Name="ports"
                                      Grid.Row="0"
                                      Grid.Column="1"
                                      Grid.ColumnSpan="2"
                                      SelectionChanged="PortsSelectionChanged"
                                      DisplayMemberPath="Value"
                                      SelectedValuePath="Key"></ComboBox>
                            <TextBlock x:Name="portStatus"
                                       Grid.Row="1"
                                       Grid.Column="1"
                                       Grid.ColumnSpan="2"
                                       VerticalAlignment="Top"></TextBlock>
                        </StackPanel>
                    </GroupBox>
                </Border>
                <Border Style="{StaticResource panel}">
                    <GroupBox Header="Firmware file path">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"
                                                  SharedSizeGroup="A" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <Button x:Name="browse"
                                    Grid.Row="0"
                                    Grid.Column="2"
                                    Click="BrowseClick">Browse...</Button>
                            <TextBlock x:Name="firmwareFileStatus"
                                       Grid.Row="1"
                                       Grid.Column="1"
                                       Grid.ColumnSpan="2"
                                       VerticalAlignment="Top"></TextBlock>
                            <TextBox x:Name="firmwareFile"
                                     Grid.Row="0"
                                     Grid.Column="1"
                                     IsReadOnly="True"
                                     TextChanged="FirmwareFileTextChanged"></TextBox>
                        </Grid>
                    </GroupBox>
                </Border>
            </StackPanel>
        </Expander>
    </Grid>
</Window>